package com.ostrich.cloud.ostrichGoodsService.app.component;


import com.woniuxy.cloud.starter.context.ContextInfo;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;

import javax.servlet.http.HttpServletRequest;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

import static com.woniuxy.cloud.starter.context.ContextInfoHolder.getContextInfo;

public class Utlis {

    public static Integer getParentId() {
        ContextInfo contextInfo = getContextInfo();
        return contextInfo.getOperatorId();
    }
    public static String dateToCron(LocalDateTime date) {

        String cronFormat="ss mm HH dd MM ? yyyy";
        return DateTimeFormatter.ofPattern(cronFormat).format(date);
    }
}
